package com.spring.reactive.program.routes;

import com.spring.reactive.program.controller.UserServiceHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

/**
 * @Author: TongRui乀
 * @Date: 2021/4/10 15:28
 * @description： 用户服务的路由注册
 */
@Configuration
public class UserServiceRoute {

    @Bean
    public RouterFunction<ServerResponse> userRoute(UserServiceHandler userServiceHandler){
        return RouterFunctions.route(RequestPredicates.GET("/user/get")
                                        .and(RequestPredicates.accept(MediaType.TEXT_HTML))
                                        .and(RequestPredicates.contentType(MediaType.TEXT_HTML)),
                                    userServiceHandler);

    }

}
